package com.lzq.leetcode.hoot100;

import com.lzq.leetcode.hoot100.ds.ListNode;

import java.util.*;

public class s160 {

    public ListNode getIntersectionNode(ListNode headA, ListNode headB) {
        ListNode pA = headA, pB = headB;
        while (pA != pB) {
            pA = pA == null ? pB : pA.next;
            pB = pB == null ? pA : pB.next;
        }
        return pA;
    }
}
